<template>
    <div id="login">
        <!-- 网站标题 -->
        <div id="website">
            云刷题系统
        </div>
        <!-- 登录框 -->
        <div id="loginFrame">
            <!-- 进度条 -->
            <div id="steps">
                <el-steps :active="currStep">
                    <el-step title="请输入邮箱地址" icon="el-icon-message"></el-step>
                    <el-step title="请输入密码" icon="el-icon-key"></el-step>
                </el-steps>
            </div>
            <!-- 登录界面输入框 -->
            <div class="loginInput">
                <!-- 根据currStep判断当前步骤 -->
                <!-- 步骤一 -->
                <div v-if="currStep === 1" class="inputItem">
                    <el-input
                            size="large"
                            placeholder="请输入邮箱"
                            prefix-icon="el-icon-message"
                            v-model="email">
                    </el-input>
                </div>
                <!-- 步骤二 -->
                <div v-if="currStep === 2" class="inputItem">
                    <el-input
                            size="large"
                            placeholder="请输入密码"
                            prefix-icon="el-icon-key"
                            v-model="password">
                    </el-input>
                </div>
            </div>
            <div class="nextButton">
                <el-button icon="el-icon-right" @click="nextStep">Next</el-button>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Login",
        data() {
            return {
                currStep: 1,
                email: "",
                password: ""
            }
        },
        methods: {
            nextStep() {
                // 步骤已经走完了，准备验证密码和跳转页面
                if (this.currStep === 2) {
                    // 暂时无法验证账号密码正确直接跳转
                    this.$message({
                        message: '欢迎你的登录',
                        type: 'success'
                    });
                    this.$router.push('/home')
                }
                this.currStep += 1;
            }
        }
    }
</script>

<style scoped>
    #website {
        width: 100%;
        height: 30px;
        line-height: 30px;
        text-align: center;
        font-size: 30px;
        margin-top: 50px;
        letter-spacing: 5px;
    }

    #loginFrame {
        width: 55%;
        height: 450px;
        margin: 0 auto;
        margin-top: 50px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
        border-radius: 5px;
    }

    #steps {
        width: 50%;
        margin: 0 auto;
        padding: 20px;
    }

    .inputItem {
        width: 65%;
        margin: 0 auto;
        height: 20px;
    }

    /*修改element ui 输入框的高度*/
    .inputItem >>> .el-input__inner {
        height: 3vw;
        line-height: 3vw;
    }

    .loginInput {
        margin-top: 50px;
    }

    .nextButton {
        width: 26%;
        margin-top: 140px;
        float: right;
    }
</style>
